/**
 * @class YAHOO.ext.Line
 * @extends YAHOO.ext.util.Observable
 * Simple Vector Line class
 * @cfg {String} Id optional to identify the line 
 * @cfg fromx fromy beginning point of line
 * @cfg tox toy end point of line
 * @cfg {Number} strokeweight width of line
 * @cfg {String} strokecolor color of line
 * @constructor
 * Create a new line
 * @param {String/HTMLElement/Element} renderTo The element to append the button to
 * @param {Object} config The config object
 */
YAHOO.ext.Vector.Line = function(renderTo,config){
	this.id = YAHOO.util.Dom.generateId();
	this.strokeweight = '1px';
	this.strokecolor = 'black';
	YAHOO.ext.util.Config.apply(this,config);
    if(renderTo){
        this.render(renderTo);
    }
}
YAHOO.extendX(YAHOO.ext.Vector.Line, YAHOO.ext.util.Observable, {
    lineTemplate: new YAHOO.ext.DomHelper.Template('<v:line id={id} ' +
      'stroke=true strokecolor={strokecolor} strokeweight={strokeweight} ' +
      'style="position:relative;left:0px;top:0px" coordorigin="0,0" ' +
      'to="{tox},{toy}" from="{fromx},{fromy}"><v:line>'), 	/*.compile(),*/
    render : function(renderTo){
      this.el = this.lineTemplate.append(getEl(renderTo).dom, this, true);
      return this.el;
    }, 
    getEl : function(){
        return this.el;  
    }
});
/**
 * @class YAHOO.ext.Polyline
 * @extends YAHOO.ext.util.Observable
 * Simple Vector PolyLine class
 * @cfg {Number} strokeweight width of line
 * @cfg {Array} pts x and y pairs 
 * @cfg {String} strokecolor color of line
 * @constructor
 * Create a new line
 * @param {String/HTMLElement/Element} renderTo The element to append the button to
 * @param {Object} config The config object
 */
YAHOO.ext.Vector.Polyline = function(renderTo,config){
	YAHOO.ext.util.Config.apply(this,config);
    if(renderTo){
        this.render(renderTo);
    }
}
YAHOO.extendX(YAHOO.ext.Vector.Polyline, YAHOO.ext.util.Observable, {
    render : function(renderTo){
       	var s = "";
       	for(var i=0; i<this.pts.length; i++) {
       		s += this.pts[i].x + ' ' + this.pts[i].y + ' ';
       	}
        this.polyTemplate = new YAHOO.ext.DomHelper.Template('<v:polyline id="' + YAHOO.util.Dom.generateId() + '" ' + 
        'filled=false stroke=true strokecolor="' + this.strokecolor + '" strokeweight="' + this.strokeweight + 
        '" Points="' + s + '"></v:polyline>');
       
		this.el = this.polyTemplate.append(getEl(renderTo).dom, [''], true);
    },
    /**
     * Returns the polyline element
     * @return {YAHOO.ext.Element}
     */
    getEl : function(){
        return this.el;  
    }
});	
/**
 * @class YAHOO.ext.Box
 * @extends YAHOO.ext.util.Observable
 * Simple Vector Rectangle class
 * @cfg {Number} strokeweight width of line
 * @cfg {String} strokecolor color of line
 * @constructor
 * @param {String/HTMLElement/Element} renderTo The element to append the button to
 * @param {Object} config The config object
 */
YAHOO.ext.Vector.Box = function(renderTo,config){
	this.shadow = 'true';
	this.strokecolor = 'black';
	this.strokweight = '1';
	this.cls ='graph-box';
	this.left = 0;
	this.top = 0;
	this.text = '';
	this.id = YAHOO.util.Dom.generateId();
	YAHOO.ext.util.Config.apply(this,config);
	this.events = {
    };
    if(renderTo){
        this.render(renderTo);
    }
}
YAHOO.extendX(YAHOO.ext.Vector.Box, YAHOO.ext.util.Observable, {
    boxTemplate : new YAHOO.ext.DomHelper.Template('<v:rect id="{id}" ' + 
	        ' class={cls} style="position:relative;width:{width};height:{height};' +
		    'left:{left};top:{top};" strokecolor={strokecolor} strokeweight={strokeweight} >' + 
	        '<v:shadow on={shadow} />' +
			'<v:textbox v-text-anchor=middle style="height:20px;margin:0px 0px 0px 0px;font:8pt arial">{text}</v:textbox>' +
	        '</v:rect>'),
	render : function(renderTo){
			this.el = this.boxTemplate.append(getEl(renderTo).dom, this, true);
		    return this.el;
        },
    getEl : function(){
        return this.el;  
    }
});	
/**
 * @class YAHOO.ext.Vector.RoundBox
 * @extends YAHOO.ext.Vector.Box
 * @constructor
 * @param {String/HTMLElement/Element} renderTo The element to append the button to
 * @param {Object} config The config object
 */
YAHOO.ext.Vector.RoundBox = function(renderTo,config){
	YAHOO.ext.Vector.RoundBox.superclass.constructor.call(this, renderTo,config);
	}
YAHOO.extendX(YAHOO.ext.Vector.RoundBox, YAHOO.ext.Vector.Box, {
    boxTemplate : new YAHOO.ext.DomHelper.Template('<v:roundrect id="{id}" ' + 
	        ' class={cls} style="position:relative;width:{width};height:{height};' +
		    'left:{left};top:{top};" strokecolor={strokecolor} strokeweight={strokeweight} >' + 
	        '<v:shadow on={shadow} />' +
			'<v:textbox v-text-anchor=middle style="height:20px;margin:0px 0px 0px 0px;font:8pt arial">{text}</v:textbox>' +
	        '</v:roundrect>')
});	

YAHOO.ext.Vector.Group = function(renderTo, config){
	this.left = 0;
	this.top = 0;
	YAHOO.ext.util.Config.apply(this,config);	
	this.groupTemplate = new YAHOO.ext.DomHelper.Template('<v:group ' +
		'style="position:relative;left:{left};top:{top};width:{width};height:{height};" ' +
		'coordsize="{width},{height}" coordorigin="0,0">');
	this.el = this.groupTemplate.append(getEl(renderTo).dom, this, true);
	this.getEl = function(){
		return this.el;
	}
}
